package com.bulletelc.apollopre.module.main.center.bargain;

import android.content.Context;
import android.widget.Toast;

import com.bulletelc.apollopre.MyApplication;
import com.bulletelc.apollopre.R;
import com.bulletelc.apollopre.constants.GlobalConfig;
import com.bulletelc.apollopre.constants.NetWorkPath;
import com.bulletelc.apollopre.framework.BasePresenter;
import com.bulletelc.apollopre.utils.LogUtil;
import com.bulletelc.apollopre.utils.ToastUtil;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
/**
 * author: lyx
 * date  : 2018-06-22
 * desc  : bargain presenter
 */

public class BargainPresenter extends BasePresenter<BargainContract.View> implements BargainContract.Persenter {
    private Context context;
    @Override
    public void attachView(BargainContract.View view) {

    }
    /**
     * 删除指定搜藏
     */
    private void removeCollection(String collectionId, final int position) {
        OkGo.<String>post(NetWorkPath.POST_USER_COLLECTION_DELETE + "?id=" + collectionId)
                .headers(NetWorkPath.HEADER_KEY_AUTH, GlobalConfig.AUTH_HEAD + MyApplication.getToken())
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        ToastUtil.showLongToast(context, R.string.network_msg);
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        if (isViewAttached()) {
                            Toast.makeText(context, "hello", Toast.LENGTH_SHORT).show();
                        }
                    }
                });
    }

    @Override
    public void start() {

    }

    @Override
    public void stop() {

    }

    @Override
    public void persenterTest() {
        LogUtil.i("----i-----");
    }

    @Override
    public void getIntentList() {

    }
}
